<?php

class Technical_ParticularyorderController extends Zend_Controller_Action
{

    public function init(){  
    }
    public function indexAction(){
    }

    public function addAction()
    {
    	$form = new Application_Form_ParticularyOrder();
    	$form->appendValidationEngineFiles($this->view); 
    	$polish = BH_TranslatePL::getPolishTranslation();
  		$translate = new Zend_Translate('array', $polish, 'pl');
  		$form->setTranslator($translate);
    	
    	$form->submit->setLabel('Dodaj nowy szczegół zamówienia');
		$this->view->ParticularyOrderForm = $form;
    	
    	$request = $this->getRequest();
    	if ($request->isPost()) {
    		if ($form->isValid($request->getPost())) {
    			$particularyOrder = new Application_Model_Entities_ParticularyOrder();
    			$particularyOrder->setSubject( $form->getValue('subjectID') );
    			$particularyOrder->setNumberWeek( $form->getValue('numberWeek') );
    			$particularyOrder->setDimensionSemester( $form->getValue('dimensionSemester') );
    			$particularyOrder->setHourYear( $form->getValue('hourYear') );
    			$particularyOrder->setHourSemester( $form->getValue('hourSemester') );
    			$particularyOrder->setSemester( $form->getValue('semesterID') );
    			$particularyOrder->setTypeCourse( $form->getValue('typeCourseID') );
    			$particularyOrder->setTypeCredit( $form->getValue('typeCreditID') );
    			$particularyOrder->setOrder( $form->getValue('orderID') );
    			$particularyOrder->setUserOrder( $form->getValue('userOrderID') );
    			$particularyOrderDao = new Application_Model_Dao_Order();
    			$particularyOrderDao->saveParticularyOrder($particularyOrder);
    		//	$result = Zend_Auth::getInstance()->authenticate($order);
    			//if ($result->isValid()) {
    				$this->_helper->redirector('index');
    			} else {
    				//$form->login->addError('Należy wypełnić wszystkie pola.');
    			}
    		//}
    	}
    }
}
